﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LogManager.Controllers
{
    public class DownloadController : Controller
    {
        /// <summary>
        /// Get download that is already prepared in the cache.
        /// </summary>
        /// <param name="cid">Id of the download element in the cache</param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult PreparedDownload(string cid)
        {
            var download = HttpContext.Cache.Get(cid) as ActionResult;
            return download;
        }

        [HttpGet]
        public JsonResult PreparedDownloadReady(string cid)
        {
            return Json(HttpContext.Cache.Get(cid) as ActionResult != null, JsonRequestBehavior.AllowGet);
        }
    }
}
